<?php
declare (strict_types=1);

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\facade\Db;

class Hello extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('hello')->setDescription('the hello command');
    }

    protected function execute(Input $input, Output $output)
    {
        $list = Db::name('user')
            ->where('is_public', 0)
            ->where('status', 4)
            ->where('last_record_time', '<', strtotime("-90days"))
            ->select();
        foreach ($list as $value) {
            Db::name('user')
                ->where('id', $value['id'])
                ->update([
                    'is_public' => 1
                ]);
        }
        $output->writeln('hello');
    }
}
